/*
 * ShoppingCartInvalidHolder.java
 * business
 *
 * Created by ChenTao on 2016/9/13.
 *
 * Copyright (c) 2016年 yidiandao. All rights reserved.
 */

package com.yidiandao.business.ui.widget.listview.viewholder;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.yidiandao.business.R;
import com.yidiandao.business.data.bean.Goods;
import com.yidiandao.business.ui.widget.listview.ViewHolder;
import com.yidiandao.business.utils.ImageLoader;
import com.yidiandao.business.utils.UIUtils;

/** 购物车失效商品的ViewHolder */
public class ShoppingCartInvalidHolder extends ViewHolder {

    private ImageView mIvGoodsImage;
    private TextView mTvTitle;
    private TextView mTvPrice;

    @Override
    protected void initView(View rootView) {
        mIvGoodsImage = (ImageView) rootView.findViewById(R.id.iv_goods_image);
        mTvTitle = (TextView) rootView.findViewById(R.id.tv_title);
        mTvPrice = (TextView) rootView.findViewById(R.id.tv_price);
    }

    public void refreshUI(Goods goods) {
        mTvTitle.setText(goods.getGoodsName());
        mTvPrice.setText(UIUtils.getString(R.string.shopping_cart_value, goods.getGoodsPrice()));
        ImageLoader.loadImage(mContext, mIvGoodsImage, goods.getGoodsThumb());
    }

    @Override
    protected int getItemLayoutId() {
        return R.layout.item_shopping_cart_invalid;
    }
}
